package com.tanhua.autoconfig;

import com.tanhua.properties.AipFaceProperties;
import com.tanhua.properties.OssProperties;
import com.tanhua.properties.SmsProperties;
import com.tanhua.template.AipFaceTemplate;
import com.tanhua.template.OssTemplate;
import com.tanhua.template.SmsTemplate;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: cfl
 * @CreateTime: 2021-06-18 22:23
 * @Description: app第三方工具配置类
 */
@Configuration
@EnableConfigurationProperties({
        SmsProperties.class,
        OssProperties.class,
        AipFaceProperties.class
})
public class TanhuaAutoConfiguration {

    /**
     * @Param: [smsProperties]
     * @return: com.tanhua.template.SmsTemplate
     * @Description: 发送短信
     */
    @Bean
    public SmsTemplate smsTemplate(SmsProperties smsProperties) {
        return new SmsTemplate(smsProperties);
    }

    /**
     * @Param: [ossProperties]
     * @return: com.tanhua.template.OssTemplate
     * @Description: 对象云存储oss 存储图片
     */
    @Bean
    public OssTemplate ossTemplate(OssProperties ossProperties){
        return new OssTemplate(ossProperties);
    }

    /**
     * @Param: [aipFaceProperties]
     * @return: com.tanhua.template.AipFaceTemplate
     * @Description: 百度云AI 人脸识别
     */
    @Bean
    public AipFaceTemplate aipFaceTemplate(AipFaceProperties aipFaceProperties){
        return new AipFaceTemplate(aipFaceProperties);
    }


}
